import { createBrowserRouter } from 'react-router-dom'
import { lazy } from 'react'
import Home from '../views/Home/index'
import Login from '../views/Login/index'
import Error from '../views/404/index'
const Index = lazy(() => import('../views/Index/index'))
const User = lazy(() => import('../views/User/index'))
const Order = lazy(() => import('../views/Order/index'))
const Wzlb = lazy(() => import('../views/Wzlb/index'))
const Tjlb = lazy(() => import('../views/Tjlb/index'))
export const routerHomes = [
    {
        path: '/home/index',
        element: <Index></Index>,
        title: '后台首页'
    },
    {
        path: '/home/user',
        element: <User></User>,
        title: '文章管理',
        children:[
            {
                path: '/home/user/wzlb',
                element: <Wzlb></Wzlb>,
                title: '文章列表',
            },
            {
                path: '/home/user/tjlb',
                element: <Tjlb></Tjlb>,
                title: '添加列表',
            },
        ]
    },
    {
        path: '/home/order',
        element: <Order></Order>,
        title: '用户管理'
    },
]
const router = createBrowserRouter([
    {
        path: '/home',
        element: <Home></Home>,
        children: routerHomes
    },
    {
        path: '/login',
        element: <Login></Login>
    },
    {
        path: '*',
        element: <Error></Error>
    },
])
export default router